import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (cases) => {
    const res = await request({
        url: "/a/content/case/list",
        method: "post",
        params: {
            casesTitle: cases.casesTitle,
            pageNo: cases.pageNo,
            pageSize: cases.pageSize,
        }
    })
    return res.data;
}



//保存数据
fun.saveCase = async (cases) => {
    const res = await request({
        url: "/a/content/case/save",
        method: "put",
        params: {
            customerImage:cases.customerImage,
            companyType:cases.companyType,
            caseTitle:cases.caseTitle,
            caseContent:cases.caseContent,
            sort:cases.sort,
            remarks:cases.remarks,
        }
    })
    return res.data;
}



//更新数据
fun.updateCase = async (cases) => {
    const res = await request({
        url: "/a/content/case/update",
        method: "post",
        params: {
            id: cases.id,
            customerImage:cases.customerImage,
            companyType:cases.companyType,
            caseTitle:cases.caseTitle,
            caseContent:cases.caseContent,
            sort:cases.sort,
            remarks:cases.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/case/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getCase = async (id) => {
    const res = await request({
        url: "/a/content/case/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


export default fun;